home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 1 (Walnut Creek)
/
Aminet - June 1993 [Walnut Creek].iso
/
aminet
/
text
/
tex
/
tgrind.lha
/
TGrind
/
tgrind.man
(
.txt
)
< prev
next >
Wrap
LaTeX Document
|
1993-01-04
|
4KB
|
106 lines
TGRIND(1)
tgrind - grind nice program listings using TeX
SYNOPSIS
tgrind [ -f ] [ - ] [ -n ] [ -h header ] [ -d <description
file> ] [ -l<language> ] name ...
DESCRIPTION
[1mTgrind
[0m formats program sources in a nice style using
[1mTeX(1)
Comments are placed in italics, keywords in bold face and
strings in typewriter font. Source file line numbers appear
in the right margin (every 10 lines). The start of a func-
tion is indicated by the function name in large type in the
right margin.
In regular mode
[1mtgrind
[0m processes its input file(s) and
passes them to
[1mTeX(1)
[0m for formatting and output.
In format mode (i.e., when the -f flag is used),
[1mtgrind
processes its input file(s) and writes the result to stan-
dard output. This output can be saved for later editing,
inclusion in a larger document, etc.
The options are:
-f forces format mode
- take input from standard input
-n don't boldface keywords
-h specifies text to go on the left side of every output
page (default is none)
-d specifies the language definitions file (default is
tex:inputs/tgrindefs)
-l specifies the language to use. Currently known are C
(-lc or the default), C++ (-lcc), TeX (-ltex), Yacc (-
ly), Prolog (-lprolog), Icon (-lI), Motorola 68K assem-
bler (-la68), Pascal (-lp), Modula-2 (-lm2), Ratfor (-
lr), MODEL (-lm), ISP (-li), arbitrary source (-lsrc),
CSH (-lcsh), and Bourne Shell (-lsh).
Using Tgrind with LaTex
Use the -f option to tgrind to produce file(s) of the code
you want to include in a LaTeX document. Edit the document
and add a tgrind option to the \documentstyle command. Then
include the formatted code files, wrapping each in a tgrind
environment (i.e.,
[1m\begin{tgrind}
[0m ...
[1m\end{tgrind}
1
TGRIND(1)
By default, the tgrind environment produces a vertical list
of vboxes (use the TeXBook to translate this sentence into
English). This is the most flexible format (in particular,
the TeX page builder will have the freedom to break the code
across page(s)) but, to handle some common but less flexible
formats, an option may follow the
[1m\begin
[1mtgrind
[0m}:
[c] Center the code as a block. This option will also
prevent the code from being broken across pages.
[n] Number the lines. Every 10th line has a small number
placed in the right margin (as in the normal tgrind
output).
[b] Box the code. The code will be enclosed in a
[1mvbox
This allows the formatted code to be used in contexts
where it normally couldn't be. E.g., math mode, a par-
box, a vcenter, etc. This will also prevent the code
from being broken across pages.
FILES
tgrindmac.tex macro package
tgrind.sty LaTeX style file
tex:inputs/tgrindefs language descriptions
AUTHOR
Van Jacobson, Lawrence Berkeley Laboratory (based on
"vgrind" by Dave Presotto & William Joy of UC Berkeley).
Amiga port by Kari Sutela, University of Turku.
SEE ALSO
tex(1), vgrind(1), vgrindefs(5)
The marginal-function-name mechanism depends on the quality
of the language description in
[1mtgrindefs
[0m. The distributed
[1mtgrindefs
[0m fails to recognize many legal C function declara-
tions.
Arbitrary formatting styles for programs mostly look bad.
The use of spaces to align source code often fails miserably
(because of the variable width output font). If you plan to
[1mtgrind
[0m your program, try to use tabs.
The indexing option of
[1mvgrind
[0m is missing. However, nice
indices can be generated using the -v option of
[1mctags
together with appropriate TeX macros.
The -f flag means different things to
[1mtgrind
[0m and
[1mvgrind